#ifndef BSONLISTMODEL_H
#define BSONLISTMODEL_H

#include <QtGui>
#include <QtGui>
#include <QAbstractListModel>
#include <client/dbclient.h>
#include <vector>
#include <string>
using namespace std;
using namespace mongo;

class BsonListModel : public QAbstractListModel
{
    Q_OBJECT
public:
    BsonListModel(QObject* parent=0);
signals:
    void addBSONObjTableView(BSONObj selectedObj);
public slots:
    void selectedBSONObjChanged(QModelIndex index);
public:
    int rowCount(const QModelIndex &parent) const;
    QVariant data(const QModelIndex &index, int role) const;
    QVariant headerData(int section, Qt::Orientation orientation, int role) const;
//    BsonListModel(const BsonListModel& ){
//        cout<<"copy construct function was called..."<<endl;
//    }
//    BsonListModel& operator=(const BsonListModel&)
//    {
//        cout<<"assign operator was called..."<<endl;
//    }

    virtual ~BsonListModel();
    void printBSONObjs();
    void setSelectedCollection(DBClientConnection* clientConnect,string collectionName);
    mutable QVector<BSONObj> allBSONObjs;
    vector<string> allNames;
    string collectionName;
    DBClientConnection* clientConnection;
};

#endif // BSONLISTMODEL_H
